<?php

namespace App\Http\Controllers\Api\V1\Frontend;


use App\Http\Controllers\BaseController;
use App\Models\Category;
use App\Transformers\Frontend\CategoryTransformer;

class CategoryController extends BaseController
{

    /**
     * @api                         {get} /frontend/category  分类列表
     * @apiVersion                  1.0.0
     * @apiName                     load_category
     * @apiGroup                    Category
     * @apiDescription              课程列表
     * @apiParam (get param)         {Integer}   page 页码(可选)
     * @apiSuccess {Number}          status_code    (200) 状态码
     * @apiSuccess {Object}          data                               列表数组
     * @apiSuccess {Integer}         data.id                             ID
     * @apiSuccess {String}          data.name                          名称
     * @return \Dingo\Api\Http\Response
     */
    public function index()
    {
        $categorys = Category::all();
        return $this->response->collection($categorys, new CategoryTransformer());
    }
}
